package sample9;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class BorderLayoutDemo {

	public static void main(String[] args) {
		JFrame frame = new JFrame("BorderLayoutDemo");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		JPanel panel1 = new JPanel();
		panel1.setBackground(Color.black);
		panel1.setPreferredSize(new Dimension(100, 100));
		frame.add(BorderLayout.NORTH, panel1);
		JPanel panel2 = new JPanel();
		panel2.setBackground(Color.blue);
		panel2.setPreferredSize(new Dimension(300, 200));
		JTextField field = new JTextField();
		field.setPreferredSize(new Dimension(100, 25));
		panel2.setLayout(new GridLayout(1, 1));
		panel2.add(field);
		panel2.add(new JButton("OK"));

		frame.add(BorderLayout.WEST, panel2);
		JPanel panel3 = new JPanel();
		panel3.setBackground(Color.cyan);
		panel3.setPreferredSize(new Dimension(100, 200));
		frame.add(BorderLayout.CENTER, panel3);
		JPanel panel4 = new JPanel();
		panel4.setBackground(Color.green);
		panel4.setPreferredSize(new Dimension(100, 100));
		frame.add(BorderLayout.EAST, panel4);
		JPanel panel5 = new JPanel();
		panel5.setBackground(Color.orange);
		panel5.setPreferredSize(new Dimension(100, 100));
		frame.add(BorderLayout.SOUTH, panel5);

		frame.setSize(800, 600);
		frame.setVisible(true);
	}
}